namespace QMVnSoft.SystemForms
{
    using QMVnSoft;
    using QMVnSoft.Controls;
    using QMVnSoft.DAL;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.IO;
    using System.Windows.Forms;

    public class FormExportHTKK : FormControl
    {
        private BtnControl btnClose;
        private BtnControl btnOk;
        private BtnControl btnPathBackup;
        private IContainer components;
        private string CRLF = "\r\n";
        private bool ib_FirstRow = true;
        private int ii_RowIndex;
        private LabelControl labelControl1;
        private LabelControl lblHD_Huy;
        private LabelControl lblHD_Huy0;
        private LabelControl lblNgay_Ct1;
        private LabelControl lblNgay_Ct2;
        private LabelControl lblPathBackup;
        private LabelControl lblTien_DN;
        private LabelControl lblTk_1331;
        private LabelControl lblTk_3331;
        private string TAB1 = "\t";
        private string TAB2 = "\t\t";
        private string TAB3 = "\t\t\t";
        private TextOption txtHD_Huy;
        private TextDate txtNgay_Ct1;
        private TextDate txtNgay_Ct2;
        private TextControl txtPathBackup;
        private TextControl txtTen_Tk_1331;
        private TextControl txtTen_Tk_3331;
        private TextNumeric txtTien_DN;
        private TextSearch txtTk_1331;
        private TextSearch txtTk_3331;

        public FormExportHTKK()
        {
            this.InitializeComponent();
            this.txtNgay_Ct1.Value = AppInstance.StartWorkingDate;
            this.txtNgay_Ct2.Value = AppInstance.EndWorkingDate;
            this.txtTk_1331.Value = "133";
            this.txtTk_3331.Value = "3331";
            this.txtTen_Tk_1331.Value = this.txtTk_1331.GetFieldData("Ten_Tk");
            this.txtTen_Tk_3331.Value = this.txtTk_3331.GetFieldData("Ten_Tk");
            object buffer = AppDataAccess.GetBuffer("TAX_TIEN_DN");
            this.txtTien_DN.Value = buffer;
            this.txtPathBackup.Value = AppDataAccess.GetBuffer("HTKKT_DESTINATION");
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            this.OnDo();
        }

        private void btnPathBackup_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dialog = new FolderBrowserDialog();
            dialog.ShowNewFolderButton = true;
            dialog.ShowDialog();
            this.txtPathBackup.Text = dialog.SelectedPath;
        }

        private string ConvertHTKKTString(object po_Value)
        {
            return po_Value.ToString().Replace("&", "&amp;").Replace("\"", "&quot;");
        }

        private string ConvertMonth(int pi_Month)
        {
            if (pi_Month < 10)
            {
                return ("0" + pi_Month.ToString().Trim());
            }
            return pi_Month.ToString().Trim();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private string EachPart(DataTable po_Table, object ps_Key1, object ps_Key2)
        {
            string str = this.TAB1 + "<Section Dynamic=\"1\" MaxRows=\"0\">" + this.CRLF;
            bool flag = true;
            DataRow row = null;
            for (int i = 0; i < po_Table.Rows.Count; i++)
            {
                row = po_Table.Rows[i];
                if (row["Loai_VAT"].Equals(ps_Key1) && row["Stt_Sx"].Equals(ps_Key2))
                {
                    flag = false;
                    break;
                }
            }
            if (flag)
            {
                this.ii_RowIndex++;
                str = str + this.EachPartNoData();
            }
            else 
            {
                for (int j = 0; j < po_Table.Rows.Count; j++)
                {
                    row = po_Table.Rows[j];
                    if (row["Loai_VAT"].Equals(ps_Key1) && row["Stt_Sx"].Equals(ps_Key2))
                    {
                        this.ii_RowIndex++;
                        str = str + this.EachRowsData(row);
                    }
                }
            }
            return (str + this.TAB1 + "</Section>" + this.CRLF);
        }
        private string EachPart1(DataTable po_Table, object ps_Key1, object ps_Key2)
        {
            string str = this.TAB1 + "<Section Dynamic=\"1\" MaxRows=\"0\">" + this.CRLF;
            bool flag = true;
            DataRow row = null;
            for (int i = 0; i < po_Table.Rows.Count; i++)
            {
                row = po_Table.Rows[i];
                if (row["Loai_VAT"].Equals(ps_Key1) && row["Stt_Sx"].Equals(ps_Key2))
                {
                    flag = false;
                    break;
                }
            }
            if (flag)
            {
                this.ii_RowIndex++;
                str = str + this.EachPartNoData1();
            }
            else
            {
                for (int j = 0; j < po_Table.Rows.Count; j++)
                {
                    row = po_Table.Rows[j];
                    if (row["Loai_VAT"].Equals(ps_Key1) && row["Stt_Sx"].Equals(ps_Key2))
                    {
                        this.ii_RowIndex++;
                        str = str + this.EachRowsData1(row);
                    }
                }
            }
            return (str + this.TAB1 + "</Section>" + this.CRLF);
        }


        private string EachPartNoData()
        {
            string str = this.TAB2 + "<Cells>" + this.CRLF;
            string[] strArray = new string[8];
            strArray[0] = str;
            strArray[1] = this.TAB3;
            strArray[2] = "<Cell CellID=\"C_";
            strArray[3] = this.ii_RowIndex.ToString().Trim();
            strArray[4] = "\" CellID2=\"C_";
            int num = this.ii_RowIndex + 10;
            strArray[5] = num.ToString().Trim();
            strArray[6] = "\" FirstCell=\"0\" Encode=\"1\" Receive=\"1\" Value=\"\" StatusID=\"0001\"/>";
            strArray[7] = this.CRLF;
            str = string.Concat(strArray);
            string[] strArray2 = new string[8];
            strArray2[0] = str;
            strArray2[1] = this.TAB3;
            strArray2[2] = "<Cell CellID=\"D_";
            strArray2[3] = this.ii_RowIndex.ToString().Trim();
            strArray2[4] = "\" CellID2=\"G_";
            int num2 = this.ii_RowIndex + 10;
            strArray2[5] = num2.ToString().Trim();
            strArray2[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"\" StatusID=\"0001\"/>";
            strArray2[7] = this.CRLF;
            str = string.Concat(strArray2);
            string[] strArray3 = new string[8];
            strArray3[0] = str;
            strArray3[1] = this.TAB3;
            strArray3[2] = "<Cell CellID=\"E_";
            strArray3[3] = this.ii_RowIndex.ToString().Trim();
            strArray3[4] = "\" CellID2=\"M_";
            int num3 = this.ii_RowIndex + 10;
            strArray3[5] = num3.ToString().Trim();
            strArray3[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"\" StatusID=\"0001\"/>";
            strArray3[7] = this.CRLF;
            str = string.Concat(strArray3);
            string[] strArray4 = new string[8];
            strArray4[0] = str;
            strArray4[1] = this.TAB3;
            strArray4[2] = "<Cell CellID=\"F_";
            strArray4[3] = this.ii_RowIndex.ToString().Trim();
            strArray4[4] = "\" CellID2=\"R_";
            int num4 = this.ii_RowIndex + 10;
            strArray4[5] = num4.ToString().Trim();
            strArray4[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"\" StatusID=\"0001\"/>";
            strArray4[7] = this.CRLF;
            str = string.Concat(strArray4);
            string[] strArray5 = new string[8];
            strArray5[0] = str;
            strArray5[1] = this.TAB3;
            strArray5[2] = "<Cell CellID=\"G_";
            strArray5[3] = this.ii_RowIndex.ToString().Trim();
            strArray5[4] = "\" CellID2=\"X_";
            int num5 = this.ii_RowIndex + 10;
            strArray5[5] = num5.ToString().Trim();
            strArray5[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"\" StatusID=\"0001\"/>";
            strArray5[7] = this.CRLF;
            str = string.Concat(strArray5);
            string[] strArray6 = new string[8];
            strArray6[0] = str;
            strArray6[1] = this.TAB3;
            strArray6[2] = "<Cell CellID=\"H_";
            strArray6[3] = this.ii_RowIndex.ToString().Trim();
            strArray6[4] = "\" CellID2=\"AB_";
            int num6 = this.ii_RowIndex + 10;
            strArray6[5] = num6.ToString().Trim();
            strArray6[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"\" StatusID=\"0001\"/>";
            strArray6[7] = this.CRLF;
            str = string.Concat(strArray6);
            string[] strArray7 = new string[8];
            strArray7[0] = str;
            strArray7[1] = this.TAB3;
            strArray7[2] = "<Cell CellID=\"I_";
            strArray7[3] = this.ii_RowIndex.ToString().Trim();
            strArray7[4] = "\" CellID2=\"AF_";
            int num7 = this.ii_RowIndex + 10;
            strArray7[5] = num7.ToString().Trim();
            strArray7[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"0\" StatusID=\"0001\"/>";
            strArray7[7] = this.CRLF;
            str = string.Concat(strArray7);
            string[] strArray8 = new string[8];
            strArray8[0] = str;
            strArray8[1] = this.TAB3;
            strArray8[2] = "<Cell CellID=\"J_";
            strArray8[3] = this.ii_RowIndex.ToString().Trim();
            strArray8[4] = "\" CellID2=\"AJ_";
            int num8 = this.ii_RowIndex + 10;
            strArray8[5] = num8.ToString().Trim();
            strArray8[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"0\" StatusID=\"0001\"/>";
            strArray8[7] = this.CRLF;
            str = string.Concat(strArray8);
            string[] strArray9 = new string[8];
            strArray9[0] = str;
            strArray9[1] = this.TAB3;
            strArray9[2] = "<Cell CellID=\"K_";
            strArray9[3] = this.ii_RowIndex.ToString().Trim();
            strArray9[4] = "\" CellID2=\"AN_";
            int num9 = this.ii_RowIndex + 10;
            strArray9[5] = num9.ToString().Trim();
            strArray9[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"0\" StatusID=\"0001\"/>";
            strArray9[7] = this.CRLF;
            str = string.Concat(strArray9);
            string[] strArray10 = new string[8];
            strArray10[0] = str;
            strArray10[1] = this.TAB3;
            strArray10[2] = "<Cell CellID=\"L_";
            strArray10[3] = this.ii_RowIndex.ToString().Trim();
            strArray10[4] = "\" CellID2=\"AR_";
            int num10 = this.ii_RowIndex + 10;
            strArray10[5] = num10.ToString().Trim();
            strArray10[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"\" StatusID=\"0001\"/>";
            strArray10[7] = this.CRLF;
            return (string.Concat(strArray10) + this.TAB2 + "</Cells>" + this.CRLF);
        }

        private string EachPartNoData1()
        {
            string str = this.TAB2 + "<Cells>" + this.CRLF;
            string[] strArray = new string[8];
            strArray[0] = str;
            strArray[1] = this.TAB3;
            strArray[2] = "<Cell CellID=\"C_";
            strArray[3] = this.ii_RowIndex.ToString().Trim();
            strArray[4] = "\" CellID2=\"C_";
            int num = this.ii_RowIndex + 10;
            strArray[5] = num.ToString().Trim();
            strArray[6] = "\" FirstCell=\"0\" Encode=\"1\" Receive=\"1\" Value=\"\" StatusID=\"0001\"/>";
            strArray[7] = this.CRLF;
            str = string.Concat(strArray);
            string[] strArray2 = new string[8];
            strArray2[0] = str;
            strArray2[1] = this.TAB3;
            strArray2[2] = "<Cell CellID=\"D_";
            strArray2[3] = this.ii_RowIndex.ToString().Trim();
            strArray2[4] = "\" CellID2=\"G_";
            int num2 = this.ii_RowIndex + 10;
            strArray2[5] = num2.ToString().Trim();
            strArray2[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"\" StatusID=\"0001\"/>";
            strArray2[7] = this.CRLF;
            str = string.Concat(strArray2);
            string[] strArray3 = new string[8];
            strArray3[0] = str;
            strArray3[1] = this.TAB3;
            strArray3[2] = "<Cell CellID=\"E_";
            strArray3[3] = this.ii_RowIndex.ToString().Trim();
            strArray3[4] = "\" CellID2=\"M_";
            int num3 = this.ii_RowIndex + 10;
            strArray3[5] = num3.ToString().Trim();
            strArray3[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"\" StatusID=\"0001\"/>";
            strArray3[7] = this.CRLF;
            str = string.Concat(strArray3);
            string[] strArray4 = new string[8];
            strArray4[0] = str;
            strArray4[1] = this.TAB3;
            strArray4[2] = "<Cell CellID=\"F_";
            strArray4[3] = this.ii_RowIndex.ToString().Trim();
            strArray4[4] = "\" CellID2=\"R_";
            int num4 = this.ii_RowIndex + 10;
            strArray4[5] = num4.ToString().Trim();
            strArray4[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"\" StatusID=\"0001\"/>";
            strArray4[7] = this.CRLF;
            str = string.Concat(strArray4);
            string[] strArray5 = new string[8];
            strArray5[0] = str;
            strArray5[1] = this.TAB3;
            strArray5[2] = "<Cell CellID=\"G_";
            strArray5[3] = this.ii_RowIndex.ToString().Trim();
            strArray5[4] = "\" CellID2=\"X_";
            int num5 = this.ii_RowIndex + 10;
            strArray5[5] = num5.ToString().Trim();
            strArray5[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"\" StatusID=\"0001\"/>";
            strArray5[7] = this.CRLF;
            str = string.Concat(strArray5);
            string[] strArray6 = new string[8];
            strArray6[0] = str;
            strArray6[1] = this.TAB3;
            strArray6[2] = "<Cell CellID=\"H_";
            strArray6[3] = this.ii_RowIndex.ToString().Trim();
            strArray6[4] = "\" CellID2=\"AB_";
            int num6 = this.ii_RowIndex + 10;
            strArray6[5] = num6.ToString().Trim();
            strArray6[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"\" StatusID=\"0001\"/>";
            strArray6[7] = this.CRLF;
            str = string.Concat(strArray6);
            string[] strArray7 = new string[8];
            strArray7[0] = str;
            strArray7[1] = this.TAB3;
            strArray7[2] = "<Cell CellID=\"I_";
            strArray7[3] = this.ii_RowIndex.ToString().Trim();
            strArray7[4] = "\" CellID2=\"AF_";
            int num7 = this.ii_RowIndex + 10;
            strArray7[5] = num7.ToString().Trim();
            strArray7[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"0\" StatusID=\"0001\"/>";
            strArray7[7] = this.CRLF;
            str = string.Concat(strArray7);
            //string[] strArray8 = new string[8];
            //strArray8[0] = str;
            //strArray8[1] = this.TAB3;
            //strArray8[2] = "<Cell CellID=\"J_";
            //strArray8[3] = this.ii_RowIndex.ToString().Trim();
            //strArray8[4] = "\" CellID2=\"AJ_";
            //int num8 = this.ii_RowIndex + 10;
            //strArray8[5] = num8.ToString().Trim();
            //strArray8[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"0\" StatusID=\"0001\"/>";
            //strArray8[7] = this.CRLF;
            //str = string.Concat(strArray8);
            string[] strArray8 = new string[8];
            strArray8[0] = str;
            strArray8[1] = this.TAB3;
            strArray8[2] = "<Cell CellID=\"K_";
            strArray8[3] = this.ii_RowIndex.ToString().Trim();
            strArray8[4] = "\" CellID2=\"AN_";
            int num8 = this.ii_RowIndex + 10;
            strArray8[5] = num8.ToString().Trim();
            strArray8[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"0\" StatusID=\"0001\"/>";
            strArray8[7] = this.CRLF;
            str = string.Concat(strArray8);
            string[] strArray9 = new string[8];
            strArray9[0] = str;
            strArray9[1] = this.TAB3;
            strArray9[2] = "<Cell CellID=\"L_";
            strArray9[3] = this.ii_RowIndex.ToString().Trim();
            strArray9[4] = "\" CellID2=\"AR_";
            int num9 = this.ii_RowIndex + 10;
            strArray9[5] = num9.ToString().Trim();
            strArray9[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"\" StatusID=\"0001\"/>";
            strArray9[7] = this.CRLF;
            return (string.Concat(strArray9) + this.TAB2 + "</Cells>" + this.CRLF);
        }

        private string EachRowsData(DataRow po_Row)
        {
            string str = this.TAB2 + "<Cells>" + this.CRLF;
            string[] strArray = new string[12];
            strArray[0] = str;
            strArray[1] = this.TAB3;
            strArray[2] = "<Cell CellID=\"C_";
            strArray[3] = this.ii_RowIndex.ToString().Trim();
            strArray[4] = "\" CellID2=\"C_";
            int num = this.ii_RowIndex + 10;
            strArray[5] = num.ToString().Trim();
            strArray[6] = "\" FirstCell=\"";
            strArray[7] = this.ib_FirstRow ? "0" : "1";
            strArray[8] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            strArray[9] = this.ConvertHTKKTString(po_Row["So_Seri0"]);
            strArray[10] = "\" StatusID=\"0001\"/>";
            strArray[11] = this.CRLF;
            str = string.Concat(strArray);
            string[] strArray2 = new string[10];
            strArray2[0] = str;
            strArray2[1] = this.TAB3;
            strArray2[2] = "<Cell CellID=\"D_";
            strArray2[3] = this.ii_RowIndex.ToString().Trim();
            strArray2[4] = "\" CellID2=\"G_";
            int num2 = this.ii_RowIndex + 10;
            strArray2[5] = num2.ToString().Trim();
            strArray2[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            strArray2[7] = this.ConvertHTKKTString(po_Row["So_Ct0"]);
            strArray2[8] = "\" StatusID=\"0001\"/>";
            strArray2[9] = this.CRLF;
            str = string.Concat(strArray2);
            string[] strArray3 = new string[10];
            strArray3[0] = str;
            strArray3[1] = this.TAB3;
            strArray3[2] = "<Cell CellID=\"E_";
            strArray3[3] = this.ii_RowIndex.ToString().Trim();
            strArray3[4] = "\" CellID2=\"M_";
            int num3 = this.ii_RowIndex + 10;
            strArray3[5] = num3.ToString().Trim();
            strArray3[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            strArray3[7] = ((DateTime) po_Row["Ngay_Ct0"]).ToShortDateString();
            strArray3[8] = "\" StatusID=\"0001\"/>";
            strArray3[9] = this.CRLF;
            str = string.Concat(strArray3);
            string[] strArray4 = new string[10];
            strArray4[0] = str;
            strArray4[1] = this.TAB3;
            strArray4[2] = "<Cell CellID=\"F_";
            strArray4[3] = this.ii_RowIndex.ToString().Trim();
            strArray4[4] = "\" CellID2=\"R_";
            int num4 = this.ii_RowIndex + 10;
            strArray4[5] = num4.ToString().Trim();
            strArray4[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            strArray4[7] = this.ConvertHTKKTString(po_Row["Ten_DtGTGT"]);
            strArray4[8] = "\" StatusID=\"0001\"/>";
            strArray4[9] = this.CRLF;
            str = string.Concat(strArray4);
            string[] strArray5 = new string[10];
            strArray5[0] = str;
            strArray5[1] = this.TAB3;
            strArray5[2] = "<Cell CellID=\"G_";
            strArray5[3] = this.ii_RowIndex.ToString().Trim();
            strArray5[4] = "\" CellID2=\"X_";
            int num5 = this.ii_RowIndex + 10;
            strArray5[5] = num5.ToString().Trim();
            strArray5[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            strArray5[7] = this.ConvertHTKKTString(po_Row["Ma_DtGTGT"]);
            strArray5[8] = "\" StatusID=\"0001\"/>";
            strArray5[9] = this.CRLF;
            str = string.Concat(strArray5);
            string[] strArray6 = new string[10];
            strArray6[0] = str;
            strArray6[1] = this.TAB3;
            strArray6[2] = "<Cell CellID=\"H_";
            strArray6[3] = this.ii_RowIndex.ToString().Trim();
            strArray6[4] = "\" CellID2=\"AB_";
            int num6 = this.ii_RowIndex + 10;
            strArray6[5] = num6.ToString().Trim();
            strArray6[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            strArray6[7] = this.ConvertHTKKTString(po_Row["Dien_Giai"]);
            strArray6[8] = "\" StatusID=\"0001\"/>";
            strArray6[9] = this.CRLF;
            str = string.Concat(strArray6);
            string[] strArray7 = new string[10];
            strArray7[0] = str;
            strArray7[1] = this.TAB3;
            strArray7[2] = "<Cell CellID=\"I_";
            strArray7[3] = this.ii_RowIndex.ToString().Trim();
            strArray7[4] = "\" CellID2=\"AF_";
            int num7 = this.ii_RowIndex + 10;
            strArray7[5] = num7.ToString().Trim();
            strArray7[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            strArray7[7] = this.ConvertHTKKTString(po_Row["Tien"]);
            strArray7[8] = "\" StatusID=\"0001\"/>";
            strArray7[9] = this.CRLF;
            str = string.Concat(strArray7);
            string[] strArray8 = new string[10];
            strArray8[0] = str;
            strArray8[1] = this.TAB3;
            strArray8[2] = "<Cell CellID=\"J_";
            strArray8[3] = this.ii_RowIndex.ToString().Trim();
            strArray8[4] = "\" CellID2=\"AJ_";
            int num8 = this.ii_RowIndex + 10;
            strArray8[5] = num8.ToString().Trim();
            strArray8[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            strArray8[7] = (po_Row["VAT_Ck"].ToString() == "C") ? (this.ConvertHTKKTString(po_Row["Thue_GTGT"])) : "";
            strArray8[8] = "\" StatusID=\"0001\"/>";
            strArray8[9] = this.CRLF;
            str = string.Concat(strArray8);
            string[] strArray9 = new string[10];
            strArray9[0] = str;
            strArray9[1] = this.TAB3;
            strArray9[2] = "<Cell CellID=\"K_";
            strArray9[3] = this.ii_RowIndex.ToString().Trim();
            strArray9[4] = "\" CellID2=\"AN_";
            int num9 = this.ii_RowIndex + 10;
            strArray9[5] = num9.ToString().Trim();
            strArray9[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            strArray9[7] = this.ConvertHTKKTString(po_Row["Tien3"]);
            strArray9[8] = "\" StatusID=\"0001\"/>";
            strArray9[9] = this.CRLF;
            str = string.Concat(strArray9);
            string[] strArray10 = new string[10];
            strArray10[0] = str;
            strArray10[1] = this.TAB3;
            strArray10[2] = "<Cell CellID=\"L_";
            strArray10[3] = this.ii_RowIndex.ToString().Trim();
            strArray10[4] = "\" CellID2=\"AR_";
            int num10 = this.ii_RowIndex + 10;
            strArray10[5] = num10.ToString().Trim();
            strArray10[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            strArray10[7] = this.ConvertHTKKTString(po_Row["Ghi_Chu"]);
            strArray10[8] = "\" StatusID=\"0001\"/>";
            strArray10[9] = this.CRLF;
            str = string.Concat(strArray10) + this.TAB2 + "</Cells>" + this.CRLF;
            this.ib_FirstRow = false;
            return str;
        }
        private string EachRowsData1(DataRow po_Row)
        {
            string str = this.TAB2 + "<Cells>" + this.CRLF;
            string[] strArray = new string[12];
            strArray[0] = str;
            strArray[1] = this.TAB3;
            strArray[2] = "<Cell CellID=\"C_";
            strArray[3] = this.ii_RowIndex.ToString().Trim();
            strArray[4] = "\" CellID2=\"C_";
            int num = this.ii_RowIndex + 10;
            strArray[5] = num.ToString().Trim();
            strArray[6] = "\" FirstCell=\"";
            strArray[7] = this.ib_FirstRow ? "0" : "1";
            strArray[8] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            strArray[9] = this.ConvertHTKKTString(po_Row["So_Seri0"]);
            strArray[10] = "\" StatusID=\"0001\"/>";
            strArray[11] = this.CRLF;
            str = string.Concat(strArray);
            string[] strArray2 = new string[10];
            strArray2[0] = str;
            strArray2[1] = this.TAB3;
            strArray2[2] = "<Cell CellID=\"D_";
            strArray2[3] = this.ii_RowIndex.ToString().Trim();
            strArray2[4] = "\" CellID2=\"G_";
            int num2 = this.ii_RowIndex + 10;
            strArray2[5] = num2.ToString().Trim();
            strArray2[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            strArray2[7] = this.ConvertHTKKTString(po_Row["So_Ct0"]);
            strArray2[8] = "\" StatusID=\"0001\"/>";
            strArray2[9] = this.CRLF;
            str = string.Concat(strArray2);
            string[] strArray3 = new string[10];
            strArray3[0] = str;
            strArray3[1] = this.TAB3;
            strArray3[2] = "<Cell CellID=\"E_";
            strArray3[3] = this.ii_RowIndex.ToString().Trim();
            strArray3[4] = "\" CellID2=\"M_";
            int num3 = this.ii_RowIndex + 10;
            strArray3[5] = num3.ToString().Trim();
            strArray3[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            strArray3[7] = ((DateTime)po_Row["Ngay_Ct0"]).ToShortDateString();
            strArray3[8] = "\" StatusID=\"0001\"/>";
            strArray3[9] = this.CRLF;
            str = string.Concat(strArray3);
            string[] strArray4 = new string[10];
            strArray4[0] = str;
            strArray4[1] = this.TAB3;
            strArray4[2] = "<Cell CellID=\"F_";
            strArray4[3] = this.ii_RowIndex.ToString().Trim();
            strArray4[4] = "\" CellID2=\"R_";
            int num4 = this.ii_RowIndex + 10;
            strArray4[5] = num4.ToString().Trim();
            strArray4[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            strArray4[7] = this.ConvertHTKKTString(po_Row["Ten_DtGTGT"]);
            strArray4[8] = "\" StatusID=\"0001\"/>";
            strArray4[9] = this.CRLF;
            str = string.Concat(strArray4);
            string[] strArray5 = new string[10];
            strArray5[0] = str;
            strArray5[1] = this.TAB3;
            strArray5[2] = "<Cell CellID=\"G_";
            strArray5[3] = this.ii_RowIndex.ToString().Trim();
            strArray5[4] = "\" CellID2=\"X_";
            int num5 = this.ii_RowIndex + 10;
            strArray5[5] = num5.ToString().Trim();
            strArray5[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            strArray5[7] = this.ConvertHTKKTString(po_Row["Ma_DtGTGT"]);
            strArray5[8] = "\" StatusID=\"0001\"/>";
            strArray5[9] = this.CRLF;
            str = string.Concat(strArray5);
            string[] strArray6 = new string[10];
            strArray6[0] = str;
            strArray6[1] = this.TAB3;
            strArray6[2] = "<Cell CellID=\"H_";
            strArray6[3] = this.ii_RowIndex.ToString().Trim();
            strArray6[4] = "\" CellID2=\"AB_";
            int num6 = this.ii_RowIndex + 10;
            strArray6[5] = num6.ToString().Trim();
            strArray6[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            strArray6[7] = this.ConvertHTKKTString(po_Row["Dien_Giai"]);
            strArray6[8] = "\" StatusID=\"0001\"/>";
            strArray6[9] = this.CRLF;
            str = string.Concat(strArray6);
            string[] strArray7 = new string[10];
            strArray7[0] = str;
            strArray7[1] = this.TAB3;
            strArray7[2] = "<Cell CellID=\"I_";
            strArray7[3] = this.ii_RowIndex.ToString().Trim();
            strArray7[4] = "\" CellID2=\"AF_";
            int num7 = this.ii_RowIndex + 10;
            strArray7[5] = num7.ToString().Trim();
            strArray7[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            strArray7[7] = this.ConvertHTKKTString(po_Row["Tien"]);
            strArray7[8] = "\" StatusID=\"0001\"/>";
            strArray7[9] = this.CRLF;
            str = string.Concat(strArray7);
            //string[] strArray8 = new string[10];
            //strArray8[0] = str;
            //strArray8[1] = this.TAB3;
            //strArray8[2] = "<Cell CellID=\"J_";
            //strArray8[3] = this.ii_RowIndex.ToString().Trim();
            //strArray8[4] = "\" CellID2=\"AJ_";
            //int num8 = this.ii_RowIndex + 10;
            //strArray8[5] = num8.ToString().Trim();
            //strArray8[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            //strArray8[7] = (po_Row["VAT_Ck"].ToString() == "C") ? (this.ConvertHTKKTString(po_Row["Thue_GTGT"])) : "";
            //strArray8[8] = "\" StatusID=\"0001\"/>";
            //strArray8[9] = this.CRLF;
            //str = string.Concat(strArray8);
            string[] strArray8 = new string[10];
            strArray8[0] = str;
            strArray8[1] = this.TAB3;
            strArray8[2] = "<Cell CellID=\"K_";
            strArray8[3] = this.ii_RowIndex.ToString().Trim();
            strArray8[4] = "\" CellID2=\"AN_";
            int num8 = this.ii_RowIndex + 10;
            strArray8[5] = num8.ToString().Trim();
            strArray8[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            strArray8[7] = this.ConvertHTKKTString(po_Row["Tien3"]);
            strArray8[8] = "\" StatusID=\"0001\"/>";
            strArray8[9] = this.CRLF;
            str = string.Concat(strArray8);
            string[] strArray9 = new string[10];
            strArray9[0] = str;
            strArray9[1] = this.TAB3;
            strArray9[2] = "<Cell CellID=\"L_";
            strArray9[3] = this.ii_RowIndex.ToString().Trim();
            strArray9[4] = "\" CellID2=\"AR_";
            int num9 = this.ii_RowIndex + 10;
            strArray9[5] = num9.ToString().Trim();
            strArray9[6] = "\" Encode=\"1\" Receive=\"1\" Value=\"";
            strArray9[7] = this.ConvertHTKKTString(po_Row["Ghi_Chu"]);
            strArray9[8] = "\" StatusID=\"0001\"/>";
            strArray9[9] = this.CRLF;
            str = string.Concat(strArray9) + this.TAB2 + "</Cells>" + this.CRLF;
            this.ib_FirstRow = false;
            return str;
        }

        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormExportHTKK));
            this.txtTien_DN = new QMVnSoft.Controls.TextNumeric();
            this.txtNgay_Ct2 = new QMVnSoft.Controls.TextDate();
            this.lblNgay_Ct2 = new QMVnSoft.Controls.LabelControl();
            this.txtNgay_Ct1 = new QMVnSoft.Controls.TextDate();
            this.lblNgay_Ct1 = new QMVnSoft.Controls.LabelControl();
            this.lblTien_DN = new QMVnSoft.Controls.LabelControl();
            this.txtTen_Tk_1331 = new QMVnSoft.Controls.TextControl();
            this.txtTk_1331 = new QMVnSoft.Controls.TextSearch();
            this.lblTk_1331 = new QMVnSoft.Controls.LabelControl();
            this.lblTk_3331 = new QMVnSoft.Controls.LabelControl();
            this.txtTk_3331 = new QMVnSoft.Controls.TextSearch();
            this.txtTen_Tk_3331 = new QMVnSoft.Controls.TextControl();
            this.lblHD_Huy0 = new QMVnSoft.Controls.LabelControl();
            this.txtHD_Huy = new QMVnSoft.Controls.TextOption();
            this.lblHD_Huy = new QMVnSoft.Controls.LabelControl();
            this.btnClose = new QMVnSoft.Controls.BtnControl();
            this.btnOk = new QMVnSoft.Controls.BtnControl();
            this.btnPathBackup = new QMVnSoft.Controls.BtnControl();
            this.lblPathBackup = new QMVnSoft.Controls.LabelControl();
            this.txtPathBackup = new QMVnSoft.Controls.TextControl();
            this.labelControl1 = new QMVnSoft.Controls.LabelControl();
            this.SuspendLayout();
            // 
            // txtTien_DN
            // 
            this.txtTien_DN.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTien_DN.Location = new System.Drawing.Point(123, 96);
            this.txtTien_DN.Name = "txtTien_DN";
            this.txtTien_DN.NumericValue = new decimal(new int[] {
            0,
            0,
            0,
            0});
            this.txtTien_DN.OldValue = null;
            this.txtTien_DN.Size = new System.Drawing.Size(100, 20);
            this.txtTien_DN.TabIndex = 5;
            this.txtTien_DN.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.txtTien_DN.UserTextNumericFormat  = QMVnSoft.AppInstance.TextNumericFormat.LocalAmount;
            this.txtTien_DN.Value = ((object)(resources.GetObject("txtTien_DN.Value")));
            // 
            // txtNgay_Ct2
            // 
            this.txtNgay_Ct2.DateTimeFormat  = QMVnSoft.Controls.TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct2.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtNgay_Ct2.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
            this.txtNgay_Ct2.Location = new System.Drawing.Point(316, 12);
            this.txtNgay_Ct2.Mask = "00/00/0000";
            this.txtNgay_Ct2.Name = "txtNgay_Ct2";
            this.txtNgay_Ct2.OldValue = null;
            this.txtNgay_Ct2.Size = new System.Drawing.Size(100, 20);
            this.txtNgay_Ct2.TabIndex = 1;
            this.txtNgay_Ct2.Value = ((object)(resources.GetObject("txtNgay_Ct2.Value")));
            // 
            // lblNgay_Ct2
            // 
            this.lblNgay_Ct2.AutoSize = true;
            this.lblNgay_Ct2.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblNgay_Ct2.Location = new System.Drawing.Point(256, 15);
            this.lblNgay_Ct2.Name = "lblNgay_Ct2";
            this.lblNgay_Ct2.Size = new System.Drawing.Size(54, 14);
            this.lblNgay_Ct2.TabIndex = 103;
            this.lblNgay_Ct2.Text = "Đến ngày";
            // 
            // txtNgay_Ct1
            // 
            this.txtNgay_Ct1.DateTimeFormat  = QMVnSoft.Controls.TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct1.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtNgay_Ct1.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
            this.txtNgay_Ct1.Location = new System.Drawing.Point(123, 12);
            this.txtNgay_Ct1.Mask = "00/00/0000";
            this.txtNgay_Ct1.Name = "txtNgay_Ct1";
            this.txtNgay_Ct1.OldValue = null;
            this.txtNgay_Ct1.Size = new System.Drawing.Size(100, 20);
            this.txtNgay_Ct1.TabIndex = 0;
            this.txtNgay_Ct1.Value = ((object)(resources.GetObject("txtNgay_Ct1.Value")));
            // 
            // lblNgay_Ct1
            // 
            this.lblNgay_Ct1.AutoSize = true;
            this.lblNgay_Ct1.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblNgay_Ct1.Location = new System.Drawing.Point(12, 15);
            this.lblNgay_Ct1.Name = "lblNgay_Ct1";
            this.lblNgay_Ct1.Size = new System.Drawing.Size(47, 14);
            this.lblNgay_Ct1.TabIndex = 104;
            this.lblNgay_Ct1.Text = "Từ ngày";
            // 
            // lblTien_DN
            // 
            this.lblTien_DN.AutoSize = true;
            this.lblTien_DN.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTien_DN.Location = new System.Drawing.Point(12, 99);
            this.lblTien_DN.Name = "lblTien_DN";
            this.lblTien_DN.Size = new System.Drawing.Size(105, 14);
            this.lblTien_DN.TabIndex = 102;
            this.lblTien_DN.Text = "Số tiền đề nghị hoàn";
            // 
            // txtTen_Tk_1331
            // 
            this.txtTen_Tk_1331.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Tk_1331.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(194)))), ((int)(((byte)(217)))), ((int)(((byte)(247)))));
            this.txtTen_Tk_1331.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Tk_1331.CheckTextSearched = false;
            this.txtTen_Tk_1331.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Tk_1331.Enabled = false;
            this.txtTen_Tk_1331.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Tk_1331.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Tk_1331.Location = new System.Drawing.Point(229, 36);
            this.txtTen_Tk_1331.Name = "txtTen_Tk_1331";
            this.txtTen_Tk_1331.OldValue = null;
            this.txtTen_Tk_1331.Size = new System.Drawing.Size(265, 13);
            this.txtTen_Tk_1331.TabIndex = 107;
            this.txtTen_Tk_1331.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtTen_Tk_1331.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Tk_1331.Value = ((object)(resources.GetObject("txtTen_Tk_1331.Value")));
            // 
            // txtTk_1331
            // 
            this.txtTk_1331.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtTk_1331.CheckTextSearched = false;
            this.txtTk_1331.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtTk_1331.FieldDisplay = "Ten_Tk";
            this.txtTk_1331.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTk_1331.FoundIsValid = true;
            this.txtTk_1331.Location = new System.Drawing.Point(123, 33);
            this.txtTk_1331.MaxLength = 32;
            this.txtTk_1331.Name = "txtTk_1331";
            this.txtTk_1331.OldValue = null;
            this.txtTk_1331.Size = new System.Drawing.Size(100, 20);
            this.txtTk_1331.TabIndex = 2;
            this.txtTk_1331.TableName = "DMTK";
            this.txtTk_1331.TextDisplay = this.txtTen_Tk_1331;
            this.txtTk_1331.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.txtTk_1331.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.All;
            this.txtTk_1331.Value = ((object)(resources.GetObject("txtTk_1331.Value")));
            // 
            // lblTk_1331
            // 
            this.lblTk_1331.AutoSize = true;
            this.lblTk_1331.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTk_1331.Location = new System.Drawing.Point(12, 36);
            this.lblTk_1331.Name = "lblTk_1331";
            this.lblTk_1331.Size = new System.Drawing.Size(115, 14);
            this.lblTk_1331.TabIndex = 106;
            this.lblTk_1331.Text = "Tk thuế GTGT đầu vào";
            // 
            // lblTk_3331
            // 
            this.lblTk_3331.AutoSize = true;
            this.lblTk_3331.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblTk_3331.Location = new System.Drawing.Point(12, 57);
            this.lblTk_3331.Name = "lblTk_3331";
            this.lblTk_3331.Size = new System.Drawing.Size(107, 14);
            this.lblTk_3331.TabIndex = 106;
            this.lblTk_3331.Text = "Tk thuế GTGT đầu ra";
            // 
            // txtTk_3331
            // 
            this.txtTk_3331.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtTk_3331.CheckTextSearched = false;
            this.txtTk_3331.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtTk_3331.FieldDisplay = "Ten_Tk";
            this.txtTk_3331.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTk_3331.FoundIsValid = true;
            this.txtTk_3331.Location = new System.Drawing.Point(123, 54);
            this.txtTk_3331.MaxLength = 32;
            this.txtTk_3331.Name = "txtTk_3331";
            this.txtTk_3331.OldValue = null;
            this.txtTk_3331.Size = new System.Drawing.Size(100, 20);
            this.txtTk_3331.TabIndex = 3;
            this.txtTk_3331.TableName = "DMTK";
            this.txtTk_3331.TextDisplay = this.txtTen_Tk_3331;
            this.txtTk_3331.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.txtTk_3331.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.All;
            this.txtTk_3331.Value = ((object)(resources.GetObject("txtTk_3331.Value")));
            // 
            // txtTen_Tk_3331
            // 
            this.txtTen_Tk_3331.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Tk_3331.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(194)))), ((int)(((byte)(217)))), ((int)(((byte)(247)))));
            this.txtTen_Tk_3331.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Tk_3331.CheckTextSearched = false;
            this.txtTen_Tk_3331.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Tk_3331.Enabled = false;
            this.txtTen_Tk_3331.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Tk_3331.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Tk_3331.Location = new System.Drawing.Point(229, 57);
            this.txtTen_Tk_3331.Name = "txtTen_Tk_3331";
            this.txtTen_Tk_3331.OldValue = null;
            this.txtTen_Tk_3331.Size = new System.Drawing.Size(265, 13);
            this.txtTen_Tk_3331.TabIndex = 107;
            this.txtTen_Tk_3331.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtTen_Tk_3331.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Tk_3331.Value = ((object)(resources.GetObject("txtTen_Tk_3331.Value")));
            // 
            // lblHD_Huy0
            // 
            this.lblHD_Huy0.AutoSize = true;
            this.lblHD_Huy0.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblHD_Huy0.ForeColor = System.Drawing.Color.Blue;
            this.lblHD_Huy0.Location = new System.Drawing.Point(151, 78);
            this.lblHD_Huy0.Name = "lblHD_Huy0";
            this.lblHD_Huy0.Size = new System.Drawing.Size(241, 14);
            this.lblHD_Huy0.TabIndex = 110;
            this.lblHD_Huy0.Text = "C-Có lấy hóa đơn huỷ, K-Không lấy hóa đơn huỷ";
            // 
            // txtHD_Huy
            // 
            this.txtHD_Huy.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtHD_Huy.CheckTextSearched = false;
            this.txtHD_Huy.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtHD_Huy.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtHD_Huy.InputMask = "K,C";
            this.txtHD_Huy.Location = new System.Drawing.Point(123, 75);
            this.txtHD_Huy.Name = "txtHD_Huy";
            this.txtHD_Huy.OldValue = null;
            this.txtHD_Huy.Size = new System.Drawing.Size(22, 20);
            this.txtHD_Huy.TabIndex = 4;
            this.txtHD_Huy.Text = "K";
            this.txtHD_Huy.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            this.txtHD_Huy.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtHD_Huy.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtHD_Huy.Value = "K";
            // 
            // lblHD_Huy
            // 
            this.lblHD_Huy.AutoSize = true;
            this.lblHD_Huy.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblHD_Huy.Location = new System.Drawing.Point(12, 78);
            this.lblHD_Huy.Name = "lblHD_Huy";
            this.lblHD_Huy.Size = new System.Drawing.Size(47, 14);
            this.lblHD_Huy.TabIndex = 109;
            this.lblHD_Huy.Text = "hóa đơn";
            // 
            // btnClose
            // 
            this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnClose.Font = new System.Drawing.Font("Arial", 8.25F);
            this.btnClose.Location = new System.Drawing.Point(394, 180);
            this.btnClose.Name = "btnClose";
            this.btnClose.Size = new System.Drawing.Size(100, 23);
            this.btnClose.TabIndex = 9;
            this.btnClose.Text = "&Quay ra";
            this.btnClose.UseVisualStyleBackColor = true;
            this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
            // 
            // btnOk
            // 
            this.btnOk.Font = new System.Drawing.Font("Arial", 8.25F);
            this.btnOk.Location = new System.Drawing.Point(288, 180);
            this.btnOk.Name = "btnOk";
            this.btnOk.Size = new System.Drawing.Size(100, 23);
            this.btnOk.TabIndex = 8;
            this.btnOk.Text = "&Thực hiện";
            this.btnOk.UseVisualStyleBackColor = true;
            this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
            // 
            // btnPathBackup
            // 
            this.btnPathBackup.Font = new System.Drawing.Font("Arial", 8.25F);
            this.btnPathBackup.Location = new System.Drawing.Point(465, 116);
            this.btnPathBackup.Name = "btnPathBackup";
            this.btnPathBackup.Size = new System.Drawing.Size(29, 23);
            this.btnPathBackup.TabIndex = 7;
            this.btnPathBackup.Text = "...";
            this.btnPathBackup.UseVisualStyleBackColor = true;
            this.btnPathBackup.Click += new System.EventHandler(this.btnPathBackup_Click);
            // 
            // lblPathBackup
            // 
            this.lblPathBackup.AutoSize = true;
            this.lblPathBackup.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblPathBackup.Location = new System.Drawing.Point(12, 120);
            this.lblPathBackup.Name = "lblPathBackup";
            this.lblPathBackup.Size = new System.Drawing.Size(62, 14);
            this.lblPathBackup.TabIndex = 113;
            this.lblPathBackup.Text = "Đường dẫn";
            // 
            // txtPathBackup
            // 
            this.txtPathBackup.CheckTextSearched = false;
            this.txtPathBackup.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtPathBackup.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtPathBackup.Location = new System.Drawing.Point(123, 117);
            this.txtPathBackup.Name = "txtPathBackup";
            this.txtPathBackup.OldValue = null;
            this.txtPathBackup.Size = new System.Drawing.Size(336, 20);
            this.txtPathBackup.TabIndex = 6;
            this.txtPathBackup.UserTextLength  = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtPathBackup.UserTrimMode  = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtPathBackup.Value = ((object)(resources.GetObject("txtPathBackup.Value")));
            // 
            // labelControl1
            // 
            this.labelControl1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.labelControl1.Font = new System.Drawing.Font("Arial", 8.25F);
            this.labelControl1.Location = new System.Drawing.Point(12, 165);
            this.labelControl1.Name = "labelControl1";
            this.labelControl1.Size = new System.Drawing.Size(482, 2);
            this.labelControl1.TabIndex = 113;
            // 
            // FormExportHTKK
            // 
            this.CancelButton = this.btnClose;
            this.ClientSize = new System.Drawing.Size(506, 215);
            this.Controls.Add(this.btnPathBackup);
            this.Controls.Add(this.labelControl1);
            this.Controls.Add(this.lblPathBackup);
            this.Controls.Add(this.txtPathBackup);
            this.Controls.Add(this.btnClose);
            this.Controls.Add(this.btnOk);
            this.Controls.Add(this.lblHD_Huy0);
            this.Controls.Add(this.txtHD_Huy);
            this.Controls.Add(this.lblHD_Huy);
            this.Controls.Add(this.txtTen_Tk_3331);
            this.Controls.Add(this.txtTen_Tk_1331);
            this.Controls.Add(this.txtTk_3331);
            this.Controls.Add(this.lblTk_3331);
            this.Controls.Add(this.txtTk_1331);
            this.Controls.Add(this.lblTk_1331);
            this.Controls.Add(this.txtTien_DN);
            this.Controls.Add(this.txtNgay_Ct2);
            this.Controls.Add(this.lblNgay_Ct2);
            this.Controls.Add(this.txtNgay_Ct1);
            this.Controls.Add(this.lblNgay_Ct1);
            this.Controls.Add(this.lblTien_DN);
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "FormExportHTKK";
            this.Text = "Kết xuất dữ liệu sang phần mềm HTKK";
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        private string KQT05Row1(DataTable po_Table, object ps_Key, string ps_JNumber, string ps_LNumber, string ps_Received)
        {
            DataRow row = null;
            foreach (DataRow row2 in po_Table.Rows)
            {
                if (row2["Series01"].Equals(ps_Key))
                {
                    row = row2;
                    break;
                }
            }
            if (row == null)
            {
                return "";
            }

            string str = null;
            if (!string.IsNullOrEmpty(ps_LNumber.ToString()) && !string.IsNullOrEmpty(ps_Received.ToString()))
            {
                str = this.TAB3 + "<Cell CellID=\"J_" + ps_JNumber + "\" CellID2=\"BW_" + ps_LNumber + "\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF;
                return (str + this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"CT_" + ps_LNumber + "\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            if (!string.IsNullOrEmpty(ps_LNumber.ToString()) && string.IsNullOrEmpty(ps_Received.ToString()))
            {
                str = this.TAB3 + "<Cell CellID=\"J_" + ps_JNumber + "\" CellID2=\"BW_" + ps_LNumber + "\" Encode=\"1\" Value=\"" + row["Tien"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF;
                return (str + this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"CT_" + ps_LNumber + "\" Encode=\"1\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            if (string.IsNullOrEmpty(ps_LNumber.ToString()) && !string.IsNullOrEmpty(ps_Received.ToString()))
            {
                str = this.TAB3 + "<Cell CellID=\"J_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF;
                return (str + this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            str = this.TAB3 + "<Cell CellID=\"J_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Value=\"" + row["Tien"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF;
            return (str + this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
        }

        private string KQT05Row01(DataTable po_Table, object ps_Key, string ps_JNumber, string ps_LNumber, string ps_Received)
        {
            DataRow row = null;
            foreach (DataRow row2 in po_Table.Rows)
            {
                if (row2["Series01"].Equals(ps_Key))
                {
                    row = row2;
                    break;
                }
            }
            if (row == null)
            {
                return "";
            }

            string str = null;
            if (!string.IsNullOrEmpty(ps_LNumber.ToString()) && !string.IsNullOrEmpty(ps_Received.ToString()))
            {
                str = this.TAB3 + "<Cell CellID=\"J_" + ps_JNumber + "\" CellID2=\"BW_" + ps_LNumber + "\" Encode=\"1\" Value=\"" + row["Tien"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF;
                return (str + this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"CT_" + ps_LNumber + "\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            if (!string.IsNullOrEmpty(ps_LNumber.ToString()) && string.IsNullOrEmpty(ps_Received.ToString()))
            {
                str = this.TAB3 + "<Cell CellID=\"J_" + ps_JNumber + "\" CellID2=\"BW_" + ps_LNumber + "\" Encode=\"1\" Value=\"" + row["Tien"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF;
                return (str + this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"CT_" + ps_LNumber + "\" Encode=\"1\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            if (string.IsNullOrEmpty(ps_LNumber.ToString()) && !string.IsNullOrEmpty(ps_Received.ToString()))
            {
                str = this.TAB3 + "<Cell CellID=\"J_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF;
                return (str + this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            str = this.TAB3 + "<Cell CellID=\"J_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Value=\"" + row["Tien"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF;
            return (str + this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
        }
        private string KQT05Row0111(DataTable po_Table, object ps_Key, string ps_JNumber, string ps_LNumber, string ps_Received)
        {
            DataRow row = null;
            foreach (DataRow row2 in po_Table.Rows)
            {
                if (row2["Series01"].Equals(ps_Key))
                {
                    row = row2;
                    break;
                }
            }
            if (row == null)
            {
                return "";
            }

            string str = null;
            if (!string.IsNullOrEmpty(ps_LNumber.ToString()) && !string.IsNullOrEmpty(ps_Received.ToString()))
            {
                str = this.TAB3 + "<Cell CellID=\"J_" + ps_JNumber + "\" CellID2=\"BW_" + ps_LNumber + "\" Encode=\"1\" Value=\"" + row["Tien"].ToString().Trim() + "\" MCT=\"11\"/>" + this.CRLF;
                return (str + this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"CT_" + ps_LNumber + "\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            if (!string.IsNullOrEmpty(ps_LNumber.ToString()) && string.IsNullOrEmpty(ps_Received.ToString()))
            {
                str = this.TAB3 + "<Cell CellID=\"J_" + ps_JNumber + "\" CellID2=\"BW_" + ps_LNumber + "\" Encode=\"1\" Value=\"" + row["Tien"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF;
                return (str + this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"CT_" + ps_LNumber + "\" Encode=\"1\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            if (string.IsNullOrEmpty(ps_LNumber.ToString()) && !string.IsNullOrEmpty(ps_Received.ToString()))
            {
                str = this.TAB3 + "<Cell CellID=\"J_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF;
                return (str + this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            str = this.TAB3 + "<Cell CellID=\"J_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Value=\"" + row["Tien"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF;
            return (str + this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
        }

        private string KQT05Row11(DataTable po_Table, object ps_Key, string ps_JNumber, string ps_LNumber, string ps_Received)
        {
            DataRow row = null;
            foreach (DataRow row2 in po_Table.Rows)
            {
                if (row2["Series01"].Equals(ps_Key))
                {
                    row = row2;
                    break;
                }
            }
            if (row == null)
            {
                return "";
            }
            if (!string.IsNullOrEmpty(ps_LNumber.ToString()) && !string.IsNullOrEmpty(ps_Received.ToString()))
            {
                return (this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"CT_" + ps_LNumber + "\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            if (!string.IsNullOrEmpty(ps_LNumber.ToString()) && string.IsNullOrEmpty(ps_Received.ToString()))
            {
                return (this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"CT_" + ps_LNumber + "\" Encode=\"1\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            if (string.IsNullOrEmpty(ps_LNumber.ToString()) && !string.IsNullOrEmpty(ps_Received.ToString()))
            {
                return (this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            return (this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
        }

        private string KQT05Row1B(DataTable po_Table, object ps_Key, string ps_JNumber, string ps_LNumber, string ps_Received)
        {
            DataRow row = null;
            foreach (DataRow row2 in po_Table.Rows)
            {
                if (row2["Series01"].Equals(ps_Key))
                {
                    row = row2;
                    break;
                }
            }
            if (row == null)
            {
                return "";
            }
            if (!string.IsNullOrEmpty(ps_LNumber.ToString()) && !string.IsNullOrEmpty(ps_Received.ToString()))
            {
                return (this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"CT_" + ps_LNumber + "\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            if (!string.IsNullOrEmpty(ps_LNumber.ToString()) && string.IsNullOrEmpty(ps_Received.ToString()))
            {
                return (this.TAB3 + "<Cell CellID=\"J_" + ps_JNumber + "\" CellID2=\"BW_" + ps_LNumber + "\" Encode=\"1\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            if (string.IsNullOrEmpty(ps_LNumber.ToString()) && !string.IsNullOrEmpty(ps_Received.ToString()))
            {
                return (this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            return (this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
        }

        private string KQT05Row2(DataTable po_Table, object ps_Key, string ps_JNumber, string ps_LNumber, string ps_Received)
        {
            DataRow row = null;
            foreach (DataRow row2 in po_Table.Rows)
            {
                if (row2["Series02"].Equals(ps_Key))
                {
                    row = row2;
                    break;
                }
            }
            if (row == null)
            {
                return "";
            }
            if (!string.IsNullOrEmpty(ps_LNumber.ToString()) && !string.IsNullOrEmpty(ps_Received.ToString()))
            {
                return (this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"CT_" + ps_LNumber + "\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            if (!string.IsNullOrEmpty(ps_LNumber.ToString()) && string.IsNullOrEmpty(ps_Received.ToString()))
            {
                return (this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"CT_" + ps_LNumber + "\" Encode=\"1\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            if (string.IsNullOrEmpty(ps_LNumber.ToString()) && !string.IsNullOrEmpty(ps_Received.ToString()))
            {
                return (this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            return (this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
        }
        private string KQT05Row211(DataTable po_Table, object ps_Key, string ps_JNumber, string ps_LNumber, string ps_Received)
        {
            DataRow row = null;
            foreach (DataRow row2 in po_Table.Rows)
            {
                if (row2["Series02"].Equals(ps_Key))
                {
                    row = row2;
                    break;
                }
            }
            if (row == null)
            {
                return "";
            }
            if (!string.IsNullOrEmpty(ps_LNumber.ToString()) && !string.IsNullOrEmpty(ps_Received.ToString()))
            {
                return (this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"CT_" + ps_LNumber + "\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"11\"/>" + this.CRLF);
            }
            if (!string.IsNullOrEmpty(ps_LNumber.ToString()) && string.IsNullOrEmpty(ps_Received.ToString()))
            {
                return (this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"CT_" + ps_LNumber + "\" Encode=\"1\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"11\"/>" + this.CRLF);
            }
            if (string.IsNullOrEmpty(ps_LNumber.ToString()) && !string.IsNullOrEmpty(ps_Received.ToString()))
            {
                return (this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            return (this.TAB3 + "<Cell CellID=\"L_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Value=\"" + row["Tien3"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
        }

        private string KQT05Row26(DataTable po_Table, object ps_Key, string ps_JNumber, string ps_LNumber, string ps_Received)
        {
            DataRow row = null;
            foreach (DataRow row2 in po_Table.Rows)
            {
                if (row2["Series01"].Equals("26"))
                {
                    row = row2;
                    break;
                }
            }
            if (row == null)
            {
                return "";
            }
            if (!string.IsNullOrEmpty(ps_LNumber.ToString()) && !string.IsNullOrEmpty(ps_Received.ToString()))
            {
                return (this.TAB3 + "<Cell CellID=\"J_" + ps_JNumber + "\" CellID2=\"BW_" + ps_LNumber + "\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            if (!string.IsNullOrEmpty(ps_LNumber.ToString()) && string.IsNullOrEmpty(ps_Received.ToString()))
            {
                return (this.TAB3 + "<Cell CellID=\"J_" + ps_JNumber + "\" CellID2=\"BW_" + ps_LNumber + "\" Encode=\"1\" Value=\"" + row["Tien"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            if (string.IsNullOrEmpty(ps_LNumber.ToString()) && !string.IsNullOrEmpty(ps_Received.ToString()))
            {
                return (this.TAB3 + "<Cell CellID=\"J_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Receive=\"0\" Value=\"" + row["Tien"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
            }
            return (this.TAB3 + "<Cell CellID=\"J_" + ps_JNumber + "\" CellID2=\"\" Encode=\"1\" Value=\"" + row["Tien"].ToString().Trim() + "\" MCT=\"\"/>" + this.CRLF);
        }

        private void OnDo()
        {
            if (!Directory.Exists(this.txtPathBackup.Text + @"\" + AppInstance.TaxCodeOfSubEnterprice))
            {
                MessageBox.Show("Bạn chưa đăng ký mã số thuế ở phần mềm\nHTKKT hoặc phần mềm kế toán " + AppInstance.SoftwareName + "!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                AppInstance.StartWorkingDate = (DateTime) this.txtNgay_Ct1.Value;
                AppInstance.EndWorkingDate = (DateTime) this.txtNgay_Ct2.Value;
                AppDataAccess.SetBuffer("HTKKT_DESTINATION", this.txtPathBackup.Text);
                AppDataAccess.SetBuffer("TAX_TIEN_DN", this.txtTien_DN.Value.ToString());
                ReportDataAccess access = new ReportDataAccess();

                object obj2 = "";
                DataTable table = access.KQT05_Get(AppInstance.Subsidiaries, this.txtNgay_Ct1.Value, this.txtNgay_Ct2.Value, this.txtTien_DN.Value, ref obj2, AppInstance.DefLanguage);
                string contents = ((((((("<!-- edited with XML Spy v4.1 U (http://www.xmlspy.com) by CMCSoft-->" + this.CRLF) + "<!DOCTYPE Sections SYSTEM \"..\\..\\InterfaceTemplates\\Schema.dtd\">" + this.CRLF) + "<Sections Version=\"130\">" + this.CRLF) + 
                    this.TAB1 + "<Section Dynamic=\"0\" MaxRows=\"0\">" + this.CRLF) + 
                    this.TAB2 + "<Cells>" + this.CRLF + 
                    this.TAB3 + "<Cell CellID=\"D_7\" CellID2=\"R_63\" Encode=\"1\" Value=\"" + "\" MCT=\"\"/>" + this.CRLF) +
                    this.TAB2 + "</Cells>" + this.CRLF + 
                    this.TAB1 + "</Section>" + this.CRLF) +
                    this.TAB1 + "<Section Dynamic=\"0\" MaxRows=\"0\">" + this.CRLF) + 
                    this.TAB2 + "<Cells>" + this.CRLF;
                contents = (((((((((((((contents + this.TAB3 + "<Cell CellID=\"I_23\" CellID2=\"BS_36\" Encode=\"1\" Value=\"" + (string.IsNullOrEmpty(obj2.ToString().Trim()) ? "" : "x") + "\" MCT=\"\"/>" + this.CRLF) + 
                                                this.KQT05Row211(table, "11", "24", "37", "")) + 
                                                this.KQT05Row0111(table, "23", "27", "40", "1") + 
                                                this.KQT05Row2(table, "25", "28", "41", "")) + 
                                                this.KQT05Row26(table, "26", "30", "43", "") + 
                                                this.KQT05Row1(table, "27", "31", "44", "")) + 
                                                this.KQT05Row1B(table, "29", "32", "45", "") + 
                                                this.KQT05Row1(table, "30", "33", "46", "")) + 
                                                this.KQT05Row01(table, "32", "34", "47", "1") + 
                                                this.KQT05Row01(table, "34", "35", "48", "1")) +                                               
                                                this.KQT05Row2(table, "36", "36", "49", "1") + 
                                                this.KQT05Row2(table, "37", "38", "51", "")) + 
                                                this.KQT05Row2(table, "38", "39", "52", "1") + 
                                                this.KQT05Row2(table, "39", "40", "53", "1")) + 
                                                this.KQT05Row2(table, "40", "42", "55", "") + 
                                                this.KQT05Row11(table, "40", "43", "56", "")) + 
                                                this.KQT05Row2(table, "40", "44", "57", "") + 
                                                this.KQT05Row2(table, "41", "45", "58", "")) + 
                                                this.KQT05Row2(table, "42", "46", "59", "") +
                                                this.KQT05Row2(table, "43", "47", "60", "")) + 
                                                this.TAB2 + "</Cells>" + this.CRLF) + this.TAB1 + "</Section>" + this.CRLF) ;
                
                //contents = contents + "</Sections>" + this.CRLF;

                contents = ((((((((((contents + this.TAB1 + "<Section Dynamic=\"0\" MaxRows=\"0\">" + this.CRLF) +
                            this.TAB2 + "<Cells>" + this.CRLF +
                            this.TAB3 + "<Cell CellID=\"D_49\" CellID2=\"U_65\" Encode=\"1\" Value=\"" + "\" MCT=\"\"/>" + this.CRLF) +
                            this.TAB3 + "<Cell CellID=\"D_50\" CellID2=\"U_66\" Encode=\"1\" Receive=\"0\" Value=\"" + "\" MCT=\"\"/>" + this.CRLF) +
                            this.TAB3 + "<Cell CellID=\"K_49\" CellID2=\"BV_67\" Encode=\"1\" Value=\"" + "\" MCT=\"\"/>" + this.CRLF) +
                            this.TAB3 + "<Cell CellID=\"K_50\" CellID2=\"C_63\" Encode=\"1\" Value=\"" + DateTime.Today.ToShortDateString() +"\" MCT=\"\"/>" + this.CRLF) +
                            this.TAB3 + "<Cell CellID=\"K_52\" CellID2=\"Y_63\" Encode=\"1\" Value=\"1" + "\" MCT=\"\"/>" + this.CRLF) +
                            this.TAB3 + "<Cell CellID=\"L_52\" CellID2=\"AG_63\" Encode=\"1\" Value=\"" + "\" MCT=\"\"/>" + this.CRLF) +
                            this.TAB3 + "<Cell CellID=\"O_52\" CellID2=\"AH_63\" Encode=\"1\" Receive=\"1\" Value=\"\"/>"  + this.CRLF) +
                            this.TAB3 + "<Cell CellID=\"L_14\" CellID2=\"\" Encode=\"1\" Receive=\"1\" Value=\"1701\"/>" + this.CRLF) +
                            this.TAB2 + "</Cells>" + this.CRLF +
                            this.TAB1 + "</Section>" + this.CRLF) + "</Sections>" + this.CRLF;

                object obj3 = 0;
                object obj4 = 0;
                DataTable table2 = access.KCT071_Get(AppInstance.Subsidiaries, this.txtNgay_Ct1.Value, this.txtNgay_Ct2.Value, this.txtTk_1331.Value, this.txtHD_Huy.Value, ref obj3, ref obj4, AppInstance.DefLanguage);
                string str2 = (("<!-- edited with XML Spy v4.1 U (http://www.xmlspy.com) by CMCSoft-->" + this.CRLF) + "<!DOCTYPE Sections SYSTEM \"..\\..\\InterfaceTemplates\\Schema.dtd\">" + this.CRLF) + "<Sections Version=\"130\">" + this.CRLF;
                this.ii_RowIndex = 7;
                this.ib_FirstRow = true;
                str2 = str2 + this.EachPart(table2, "1", 2);
                this.ii_RowIndex += 4;
                this.ib_FirstRow = true;
                str2 = str2 + this.EachPart(table2, "2", 2);
                this.ii_RowIndex += 4;
                this.ib_FirstRow = true;
                str2 = str2 + this.EachPart(table2, "3", 2);
                this.ii_RowIndex += 4;
                this.ib_FirstRow = true;
                str2 = str2 + this.EachPart(table2, "4", 2);
                this.ii_RowIndex += 4;
                this.ib_FirstRow = true;
                str2 = ((str2 + this.EachPart(table2, "5", 2)) + this.TAB1 + "<Section Dynamic=\"0\" MaxRows=\"0\">" + this.CRLF) + this.TAB2 + "<Cells>" + this.CRLF;
                this.ii_RowIndex += 13;
                string[] strArray3 = new string[10];
                strArray3[0] = str2;
                strArray3[1] = this.TAB3;
                strArray3[2] = "<Cell CellID=\"F_";
                strArray3[3] = this.ii_RowIndex.ToString().Trim();
                strArray3[4] = "\" CellID2=\"V_";
                int num = this.ii_RowIndex + 6;
                strArray3[5] = num.ToString().Trim();
                strArray3[6] = "\" Encode=\"1\" Value=\"";
                strArray3[7] = this.ConvertHTKKTString(obj3);
                strArray3[8] = "\"/>";
                strArray3[9] = this.CRLF;
                str2 = string.Concat(strArray3);
                this.ii_RowIndex++;
                string[] strArray4 = new string[10];
                strArray4[0] = str2;
                strArray4[1] = this.TAB3;
                strArray4[2] = "<Cell CellID=\"F_";
                strArray4[3] = this.ii_RowIndex.ToString().Trim();
                strArray4[4] = "\" CellID2=\"V_";
                int num2 = this.ii_RowIndex + 7;
                strArray4[5] = num2.ToString().Trim();
                strArray4[6] = "\" Encode=\"1\" Value=\"";
                strArray4[7] = this.ConvertHTKKTString(obj4);
                strArray4[8] = "\"/>";
                strArray4[9] = this.CRLF;
                str2 = ((string.Concat(strArray4) + this.TAB2 + "</Cells>" + this.CRLF) + this.TAB1 + "</Section>" + this.CRLF) + "</Sections>" + this.CRLF;
                
                obj3 = 0;
                obj4 = 0;
                DataTable table3 = access.KCT072_Get(AppInstance.Subsidiaries, this.txtNgay_Ct1.Value, this.txtNgay_Ct2.Value, this.txtTk_3331.Value, this.txtHD_Huy.Value, ref obj3, ref obj4, AppInstance.DefLanguage);
                string str3 = (("<!-- edited with XML Spy v4.1 U (http://www.xmlspy.com) by CMCSoft-->" + this.CRLF) + "<!DOCTYPE Sections SYSTEM \"..\\..\\InterfaceTemplates\\Schema.dtd\">" + this.CRLF) + "<Sections Version=\"130\">" + this.CRLF;
                this.ii_RowIndex = 7;
                this.ib_FirstRow = true;
                str3 = str3 + this.EachPart1(table3, "1", 2);
                this.ii_RowIndex += 4;
                this.ib_FirstRow = true;
                str3 = str3 + this.EachPart1(table3, "2", 2);
                this.ii_RowIndex += 4;
                this.ib_FirstRow = true;
                str3 = str3 + this.EachPart1(table3, "3", 2);
                this.ii_RowIndex += 4;
                this.ib_FirstRow = true;
                str3 = str3 + this.EachPart1(table3, "4", 2); 
                this.ii_RowIndex += 4;
                this.ib_FirstRow = true;
                str3 = ((str3 + this.EachPart1(table3, "5", 2)) + this.TAB1 + "<Section Dynamic=\"0\" MaxRows=\"0\">" + this.CRLF) + this.TAB2 + "<Cells>" + this.CRLF;
                this.ii_RowIndex += 4;
                string[] strArray5 = new string[10];
                strArray5[0] = str3;
                strArray5[1] = this.TAB3;
                strArray5[2] = "<Cell CellID=\"F_";
                strArray5[3] = this.ii_RowIndex.ToString().Trim();
                strArray5[4] = "\" CellID2=\"V_";
                int num3 = this.ii_RowIndex + 10;
                strArray5[5] = num3.ToString().Trim();
                strArray5[6] = "\" Encode=\"1\" Value=\"";
                strArray5[7] = this.ConvertHTKKTString(obj3);
                strArray5[8] = "\"/>";
                strArray5[9] = this.CRLF;
                str3 = string.Concat(strArray5);
                this.ii_RowIndex++;
                string[] strArray6 = new string[10];
                strArray6[0] = str3;
                strArray6[1] = this.TAB3;
                strArray6[2] = "<Cell CellID=\"F_";
                strArray6[3] = this.ii_RowIndex.ToString().Trim();
                strArray6[4] = "\" CellID2=\"V_";
                int num4 = this.ii_RowIndex + 13;
                strArray6[5] = num4.ToString().Trim();
                strArray6[6] = "\" Encode=\"1\" Value=\"";
                strArray6[7] = this.ConvertHTKKTString(obj4);
                strArray6[8] = "\"/>";
                strArray6[9] = this.CRLF;

                str3 = string.Concat(strArray6);
                this.ii_RowIndex++;
                string[] strArray7 = new string[10];
                strArray7[0] = str3;
                strArray7[1] = this.TAB3;
                strArray7[2] = "<Cell CellID=\"F_";
                strArray7[3] = this.ii_RowIndex.ToString().Trim();
                strArray7[4] = "\" CellID2=\"V_";
                int num5 = this.ii_RowIndex + 10;
                strArray7[5] = num5.ToString().Trim();
                strArray7[6] = "\" Encode=\"1\" Value=\"";
                strArray7[7] = this.ConvertHTKKTString(obj3);
                strArray7[8] = "\"/>";
                strArray7[9] = this.CRLF;
              
                //Sửa
                str3 = ((string.Concat(strArray7) + this.TAB2 + "</Cells>" + this.CRLF) + this.TAB1 + "</Section>" + this.CRLF) + "</Sections>" + this.CRLF;

                string[] strArray8 = new string[7];
                strArray8[0] = this.txtPathBackup.Text;
                strArray8[1] = @"\";
                strArray8[2] = AppInstance.TaxCodeOfSubEnterprice;
                strArray8[3] = @"\01_GTGT_";
                DateTime time2 = (DateTime)this.txtNgay_Ct2.Value;
                strArray8[4] = this.ConvertMonth(time2.Month);
                DateTime time3 = (DateTime)this.txtNgay_Ct2.Value;
                strArray8[5] = time3.Year.ToString();
                strArray8[6] = ".xml";
                File.WriteAllText(string.Concat(strArray8), contents);
                
                string[] strArray9 = new string[7];
                strArray9[0] = this.txtPathBackup.Text;
                strArray9[1] = @"\";
                strArray9[2] = AppInstance.TaxCodeOfSubEnterprice;
                strArray9[3] = @"\01_2_GTGT_";
                DateTime time4 = (DateTime) this.txtNgay_Ct2.Value;
                strArray9[4] = this.ConvertMonth(time4.Month);
                DateTime time5 = (DateTime) this.txtNgay_Ct2.Value;
                strArray9[5] = time5.Year.ToString();
                strArray9[6] = ".xml";
                File.WriteAllText(string.Concat(strArray9), str2);
                string[] strArray10 = new string[7];
                strArray10[0] = this.txtPathBackup.Text;
                strArray10[1] = @"\";
                strArray10[2] = AppInstance.TaxCodeOfSubEnterprice;
                strArray10[3] = @"\01_1_GTGT_";
                DateTime time6 = (DateTime) this.txtNgay_Ct2.Value;
                strArray10[4] = this.ConvertMonth(time6.Month);
                DateTime time7 = (DateTime) this.txtNgay_Ct2.Value;
                strArray10[5] = time7.Year.ToString();
                strArray10[6] = ".xml";
                File.WriteAllText(string.Concat(strArray10), str3);
                MessageBox.Show(AppInstance.EndMessage, AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                base.Close();
            }
        }

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == (Keys.Control | Keys.Return))
            {
                this.OnDo();
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }
    }
}

